#ifndef NetworkedActor_h__
#define NetworkedActor_h__

class BPhysicsActor;
class GMActorChanges;

class NetworkedActor
{
public:
	NetworkedActor(bool genID);
    BPhysicsActor* GetActor(){return m_actor;}
    void SetActor(BPhysicsActor* actor){ m_actor = actor;}
    void SetActive(bool state){m_active = state;}
    bool IsActive(){return m_active;}
    bool HasChanged(); //LOL
    void SendToClients();
    void UpdateToServer(GMActorChanges& gmac);
    void Update(bool server);

private:
    BPhysicsActor* m_actor;
    bool m_active;
private:
	/* This is onyl used on the Server when they are created, they are 
	   then manually SET on the Client to assure sync*/
    static int ACTOR_ID_GENERATOR;
    static int GenerateNewID() {return NetworkedActor::ACTOR_ID_GENERATOR++;}
    int m_networkID;
public:
    int GetNetworkID(){return m_networkID;}
	void SetID(int id){m_networkID = id;}

private:
	float m_curRot[4];
	float m_curPos[3];
	float m_curLVel[3];
	float m_curAVel[3];

	float m_newServerRot[4];
	float m_newServerPos[3];
	float m_newServerLVel[3];
	float m_newServerAVel[3];

	int m_serverUpdateCounter;
	bool m_recievedServerUpdate;
};

#endif // NetworkedActor_h__
